import { request } from "../util/request.js";

export default {
    //影厅列表
    get: async ({ curPage = 1, eachPage = 10 } = {}) => {
        return await request({
            type: "GET",
            url: "api/theaters",
            data: { curPage, eachPage }
        });
    },
    //更新
    upDate: async (theater) => {
        return await request({
            type: 'PUT',
            url: `api/theaters/${theater._id}`,
            data: theater
        })
    },
    getByCinemasId: async (_id) => {
        return await request({
            type: "get",
            url: `/api/cinemas/${_id}/theaters`,
        })
    },
    add: async (obj = {}) =>
        await request({
            type: 'POST',
            url: 'api/theaters/add',
            data: obj

        }),
    upDate: async (theater) => {
        console.log(theater._id);
        return await request({
            type: 'PUT',
            url: `/api/theaters/${theater._id}`,
            data: theater
        })
    }
    ,

    getOne: async ({ _id }) => {
        console.log(_id);
        return await request({
            type: 'GET',
            url: 'api/theaters/getOne',
            data: { _id }
        })
    },
    delete: async ({ _id }) => {
        console.log(_id);
        return await request({
            type: 'DELETE',
            url: `api/theaters/${_id}`
        })
    }
}